﻿<catel:UserControl x:Class="Catel.Examples.WPF.Prism.Modules.Employees.Views.EmployeesView"
                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                   xmlns:catel="http://catel.codeplex.com"
                   xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity">

    <!--  Resources  -->
    <catel:UserControl.Resources />

    <!--  Content  -->
    <catel:StackGrid>
        <catel:StackGrid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </catel:StackGrid.RowDefinitions>

        <TextBlock Margin="0,4,0,0"
                   HorizontalAlignment="Left"
                   VerticalAlignment="Top"
                   FontWeight="Bold"
                   Text="List of Employees" />

        <ListView ItemsSource="{Binding Employees}" SelectedItem="{Binding SelectedEmployee}">
            <ListView.ItemContainerStyle>
                <Style TargetType="{x:Type ListViewItem}">
                    <Setter Property="FrameworkElement.ToolTip">
                        <Setter.Value>
                            <Grid Width="300" Height="115">
                                <Grid.Background>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="#fbfcfd" />
                                        <GradientStop Offset="1" Color="#e0e3e7" />
                                    </LinearGradientBrush>
                                </Grid.Background>

                                <TextBlock Name="textBlock1"
                                           Height="23"
                                           Margin="12,12,0,0"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Top"
                                           FontWeight="Bold"
                                           Text="ID:" />
                                <TextBlock Name="textBlock2"
                                           Height="23"
                                           Margin="12,33,0,0"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Top"
                                           FontWeight="Bold"
                                           Text="First name:" />
                                <TextBlock Name="textBlock3"
                                           Height="23"
                                           Margin="12,57,0,0"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Top"
                                           FontWeight="Bold"
                                           Text="Last name:" />
                                <TextBlock Name="textBlock4"
                                           Height="23"
                                           Margin="12,80,0,0"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Top"
                                           FontWeight="Bold"
                                           Text="Department:" />
                                <TextBlock Name="textBlock5"
                                           Width="181"
                                           Height="23"
                                           Margin="107,12,0,0"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Top"
                                           Text="{Binding Id}" />
                                <TextBlock Name="textBlock6"
                                           Width="181"
                                           Height="23"
                                           Margin="107,33,0,0"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Top"
                                           Text="{Binding FirstName}" />
                                <TextBlock Name="textBlock7"
                                           Width="181"
                                           Height="23"
                                           Margin="107,57,0,0"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Top"
                                           Text="{Binding LastName}" />
                                <TextBlock Name="textBlock8"
                                           Width="181"
                                           Height="23"
                                           Margin="107,80,0,0"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Top"
                                           Text="{Binding Department.Name}" />
                            </Grid>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListView.ItemContainerStyle>

            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseDoubleClick">
                    <catel:EventToCommand Command="{Binding EditEmployee}" DisableAssociatedObjectOnCannotExecute="False" />
                </i:EventTrigger>
            </i:Interaction.Triggers>

            <ListView.View>
                <GridView>
                    <GridViewColumn Width="100"
                                    DisplayMemberBinding="{Binding Id}"
                                    Header="ID" />
                    <GridViewColumn Width="200"
                                    DisplayMemberBinding="{Binding FirstName}"
                                    Header="First name" />
                    <GridViewColumn Width="200"
                                    DisplayMemberBinding="{Binding LastName}"
                                    Header="Last name" />
                    <GridViewColumn Width="200"
                                    DisplayMemberBinding="{Binding Department.Name}"
                                    Header="Department" />
                </GridView>
            </ListView.View>
        </ListView>

        <WrapPanel Orientation="Horizontal" Style="{StaticResource RightAlignedButtonsWrapPanelStyle}">
            <Button Command="{Binding AddEmployee}" Style="{StaticResource RightAlignedFixedSizeButtonStyle}">
                <StackPanel Width="96"
                            Height="25"
                            Orientation="Horizontal">
                    <Image Width="32"
                           Source="/Catel.Examples.WPF.Prism;component/Resources/Images/action_add.png"
                           Stretch="None" />
                    <TextBlock Width="44"
                               Height="16"
                               Text="Add"
                               TextAlignment="Center" />
                </StackPanel>
            </Button>

            <Button Command="{Binding EditEmployee}" Style="{StaticResource RightAlignedFixedSizeButtonStyle}">
                <StackPanel Width="96"
                            Height="25"
                            Orientation="Horizontal">
                    <Image Width="28"
                           Source="/Catel.Examples.WPF.Prism;component/Resources/Images/action_edit.png"
                           Stretch="None" />
                    <TextBlock Width="43"
                               Height="15"
                               Text="Edit"
                               TextAlignment="Center" />
                </StackPanel>
            </Button>

            <Button Command="{Binding DeleteEmployee}" Style="{StaticResource RightAlignedFixedSizeButtonStyle}">
                <StackPanel Width="96"
                            Height="25"
                            Orientation="Horizontal">
                    <Image Width="27"
                           Source="/Catel.Examples.WPF.Prism;component/Resources/Images/action_remove.png"
                           Stretch="None" />
                    <TextBlock Width="48"
                               Height="17"
                               Text="Delete"
                               TextAlignment="Center" />
                </StackPanel>
            </Button>
        </WrapPanel>
    </catel:StackGrid>
</catel:UserControl>
